<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>YDLIDAR-SS SDK: README</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="ydliar.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">YDLIDAR-SS SDK
   &#160;<span id="projectnumber">V2.0.0</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">README </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><div class="image">
<img src="image/index-X4.jpg"  alt="YDLIDAR" title="YDLIDAR_X4"/>
</div>
<h1>YDLIDAR SDK <a href="https://travis-ci.org/cansik/sdk"></a> <a href="https://ci.appveyor.com/project/cansik/sdk"></a> <a href="https://codebeat.co/projects/github-com-cansik-sdk-samsung"></a> </h1>
<h2>Introduction </h2>
<p>YDLIDAR(<a href="https://www.ydlidar.com/">https://www.ydlidar.com/</a>) series is a set of high-performance and low-cost LIDAR sensors, which is the perfect sensor of 2D SLAM, 3D reconstruction, multi-touch, and safety applications.</p>
<p>If you are using ROS (Robot Operating System), please use our open-source <a href="https://github.com/ydlidar/ydlidar">ROS Driver</a> .</p>
<h2>Release Notes </h2>
<table class="doxtable">
<tr>
<th align="left">Title </th><th align="right">Version </th><th align="center">Data  </th></tr>
<tr>
<td align="left">SDK </td><td align="right">2.0.0 </td><td align="center">2019-01-03 </td></tr>
</table>
<ul>
<li>[new feature] Remove other lidar model interfaces functions.</li>
<li>[new feature] fix turnOn function.</li>
<li>[new feature] Lidar supports zero offset angle adjustment.</li>
</ul>
<h2>Dataset </h2>
<table class="doxtable">
<tr>
<th align="left">Model </th><th align="right">Baudrate </th><th align="right">Sampling Frequency </th><th align="right">Range(m) </th><th align="right">Scanning Frequency(HZ) </th><th align="right">Working temperature(°C) </th><th align="right">Laser power max(mW) </th><th align="right">voltage(V) </th><th align="center">Current(mA)  </th></tr>
<tr>
<td align="left">G2-SS-1 </td><td align="right">230400 </td><td align="right">5000 </td><td align="right">0.1-16 </td><td align="right">5-12</td><td align="right">0-50</td><td align="right">~5</td><td align="right">4.8-5.2</td><td align="center">400-480 </td></tr>
<tr>
<td align="left">G4 </td><td align="right">230400 </td><td align="right">9000 </td><td align="right">0.26-16 </td><td align="right">5-12</td><td align="right">0-50</td><td align="right">~5</td><td align="right">4.8-5.2</td><td align="center">400-480 </td></tr>
<tr>
<td align="left">X4 </td><td align="right">128000 </td><td align="right">5000 </td><td align="right">0.12-10 </td><td align="right">5-12</td><td align="right">0-40</td><td align="right">~5</td><td align="right">4.8-5.2</td><td align="center">330-380 </td></tr>
<tr>
<td align="left">F4 </td><td align="right">115200 </td><td align="right">4000 </td><td align="right">0.1-12 </td><td align="right">5-12</td><td align="right">0-40</td><td align="right">~5</td><td align="right">4.8-5.2</td><td align="center">400-480 </td></tr>
<tr>
<td align="left">S4 </td><td align="right">115200</td><td align="right">4000 </td><td align="right">0.1-8 </td><td align="right">6-12</td><td align="right">0-40</td><td align="right">~5</td><td align="right">4.8-5.2</td><td align="center">330-380 </td></tr>
<tr>
<td align="left">S4Pro </td><td align="right">153600</td><td align="right">4000 </td><td align="right">0.1-8 </td><td align="right">6-12</td><td align="right">0-40</td><td align="right">~5</td><td align="right">4.8-5.2</td><td align="center">330-380 </td></tr>
</table>
<h2>How to build YDLIDAR SDK samples </h2>
<p>$ git clone <a href="https://github.com/ydlidar/sdk">https://github.com/ydlidar/sdk</a> $ cd sdk $ git checkout samsung $ cd .. $ mkdir build $ cd build $ cmake ../sdk $ make ###linux $ vs open Project.sln ###windows</p>
<h2>How to run YDLIDAR SDK samples </h2>
<p>$ cd samples</p>
<p>linux: </p><pre class="fragment">$ ./ydlidar_test
$Please enter the lidar serial port:/dev/ttyUSB0
</pre><p>windows: </p><pre class="fragment">$ ydlidar_test.exe
$Please enter the lidar serial port:/dev/ttyUSB0
</pre><p>You should see YDLIDAR's scan result in the console: </p><pre class="fragment">[YDLIDAR]:SDK Version: 2.0.0
[YDLIDAR]:Lidar running correctly ! The health status: good
[YDLIDAR] Connection established in [/dev/ttyUSB0][230400]:
Firmware version: 1.2
Hardware version: 3
Model: G2-SS-1
Serial: 2018101800011111
[YDLIDAR INFO] Current Sampling Rate : 5K
[YDLIDAR INFO] Successfully obtained the offset angle[0.0000] from the lidar[2018101800011111]
[YDLIDAR INFO] Current AngleOffset : 0.000000°
[YDLIDAR INFO] Current Scan Frequency : 8.000000Hz
[YDLIDAR INFO] Now YDLIDAR is scanning ......
Scan received: 625 ranges
Scan received: 626 ranges
</pre><p>code: </p><pre class="fragment">    void ParseScan(node_info* data, const size_t&amp; size) {

        double current_frequence, current_distance, current_angle, current_intensity;

        uint64_t current_time_stamp;

        for (size_t i = 0; i &lt; size; i++ ) {

            if( data[i].scan_frequence != 0) {

                current_frequence =  data[i].scan_frequence;//or current_frequence = data[0].scan_frequence

            }

            current_time_stamp = data[i].stamp;

            current_angle = ((data[i].angle_q6_checkbit&gt;&gt;LIDAR_RESP_MEASUREMENT_ANGLE_SHIFT)/64.0f);//LIDAR_RESP_MEASUREMENT_ANGLE_SHIFT equals 8

            current_distance =  data[i].distance_q/4.f;

            current_intensity = (float)(data[i].sync_quality);

        }

        if (current_frequence != 0 ) {

            printf("current lidar scan frequency: %f\n", current_frequence);

        } else {

            printf("Current lidar does not support return scan frequency\n");

        }
    }
</pre><h2>Data structure </h2>
<p>data structure: </p><pre class="fragment">//! A struct for returning configuration from the YDLIDAR
struct LaserConfig {

    //! Start angle for the laser scan [rad].  0 is forward and angles are measured clockwise when viewing YDLIDAR from the top.
    float min_angle;

    //! Stop angle for the laser scan [rad].   0 is forward and angles are measured clockwise when viewing YDLIDAR from the top.
    float max_angle;

    //! Scan resolution [rad].
    float ang_increment;

    //! Scan resoltuion [ns]
    float time_increment;

    //! Time between scans
    float scan_time;

    //! Minimum range [m]
    float min_range;

    //! Maximum range [m]
    float max_range;

    //! Range Resolution [m]
    float range_res;

  };


  struct LaserScan {

    //! Array of ranges
    std::vector&lt;float&gt; ranges;

    //! Array of intensities
    std::vector&lt;float&gt; intensities;

    //! Self reported time stamp in nanoseconds
    uint64_t self_time_stamp;

    //! System time when first range was measured in nanoseconds
    uint64_t system_time_stamp;

    //! Configuration of scan
    LaserConfig config;

  };
</pre><p>example angle parsing: </p><pre class="fragment">LaserScan scan;

for(size_t i =0; i &lt; scan.ranges.size(); i++) {

  // current angle
  double angle = scan.config.min_angle + i*scan.config.ang_increment;// radian format

  //current distance
  double distance = scan.ranges[i];//meters

  //current intensity
  int intensity = scan.intensities[i];

}
</pre><h2>Coordinate System </h2>
<div class="image">
<img src="image/image.png"  alt="Coordinate" title="Coordinate"/>
</div>
<h3>The relationship between the angle value and the data structure in the above figure:</h3>
<pre class="fragment">double current_angle =  scan.config.min_angle + index*scan.config.ang_increment;// radian format
doube Angle = current_angle*180/M_PI;//Angle fomat
</pre><h2>Upgrade Log </h2>
<p>2019-01-03 version:2.0.0</p>
<p>1.Remove other lidar model interfaces functions.</p>
<p>2.fix turnOn function.</p>
<p>3.Lidar supports zero offset angle adjustment.</p>
<p>2018-12-07 version:1.3.9</p>
<p>1.Remove other lidar model interfaces functions.</p>
<p>2.Remove heartbeat</p>
<p>2018-11-24 version:1.3.8</p>
<p>1.Reduce abnormal situation recovery time.</p>
<p>2.fix timestamp from zero.</p>
<p>2018-10-26 version:1.3.7</p>
<p>1.add input angle calibration file.</p>
<p>2.remove network.</p>
<p>2018-10-15 version:1.3.6</p>
<p>1.add network support.</p>
<p>2018-05-23 version:1.3.4</p>
<p>1.add automatic reconnection if there is an exception</p>
<p>2.add serial file lock.</p>
<p>2018-05-14 version:1.3.3</p>
<p>1.add the heart function constraint.</p>
<p>2.add packet type with scan frequency support.</p>
<p>2018-04-16 version:1.3.2</p>
<p>1.add multithreading support.</p>
<p>2018-04-16 version:1.3.1</p>
<p>1.Compensate for each laser point timestamp.</p>
<h2>Contact EAI </h2>
<p>If you have any extra questions, please feel free to <a href="http://www.ydlidar.cn/cn/contact">contact us</a> </p>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>
